from .utils import *

# 获取电影的类型即各类型的电影个数
def getTypesData():
    typeList = typeList1('types')
    typeObj = {}
    for i in typeList:
        if typeObj.get(i, -1) == -1:
            typeObj[i] = 1
        else:
            typeObj[i] = typeObj[i] + 1
    typesList = []
    for key, values in typeObj.items():
        typesList.append({
            'name': key,
            'value': values
        })
    return typesList

# test
# getTypesData()